{% extends "../default.html" %} {% block content %}
<main>
    <div class="page">
        <div class="page_title" id="pageContents">
            {% for parentNav in currentCateList.parents %}
            <ul>
                {% for sonNav in currentCateList.cates %}
                {% if sonNav.parentId == parentNav._id %}
                {% if cateInfo._id == sonNav._id %}
                {% set navClass = 'pagecurrent'%}
                {% else %}
                {% set navClass = ''%}
                {% endif %}
                <li>
                    <a id="{{navClass}}" href="{{sonNav.url}}">{{sonNav.name}}</a>
                </li>
                {% endif %}
                {% endfor %}
            </ul>
            {% endfor %}
        </div>
        <!-- <script>
            var obj = null;
            var As = document.getElementById('pageContents').getElementsByTagName('a');
            obj = As[0];
            for (i = 1; i < As.length; i++) {
                if (window.location.href.indexOf(As[i].href) >= 0)
                    obj = As[i];
            }
            obj.id = 'pagecurrent'
        </script> -->
        <div class="page-box">
            {% if posts and posts.length>0 %}
            {% set firstDocuments = posts[posts.length-1] %}
            <h2 class="page-box-title">{{cateInfo.name}}</h2>
            <div class="content">
                {{firstDocuments.comments | safe}}
            </div>
            {% endif %}
        </div>
    </div>
</main>
{% endblock %}